broadway: Handle cairo nodes
authorAlexander Larsson <alexl@redhat.com>
Wed, 22 Nov 2017 22:42:29 +0000 (23:42 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 23 Nov 2017 09:48:29 +0000 (10:48 +0100)
This means we can directly upload these as textures, rather than
create a new surface and draw it into that. We still have to upload,
but there isn't a lot we can do about this as for these nodes
we generally redraw everything each time.

gsk/gskbroadwayrenderer.c

index ab6281350ee53190edc0172d1541023ce3cd5c36..0ed849ca697196dae81a3f00a6aafc27ed7573e3 100644 (file)
@@ -492,6 +492,25 @@ gsk_broadway_renderer_add_node (GskRenderer *self,
       }
       return;
 
+    case GSK_CAIRO_NODE:
+      {
+        const cairo_surface_t *surface = gsk_cairo_node_peek_surface (node);
+       GdkTexture *texture;
+        guint32 texture_id;
+
+       texture = gdk_texture_new_for_surface ((cairo_surface_t *)surface);
+        g_ptr_array_add (node_textures, g_object_ref (texture)); /* Transfers ownership to node_textures */
+        texture_id = gdk_broadway_display_ensure_texture (display, texture);
+
+        add_uint32 (nodes, BROADWAY_NODE_TEXTURE);
+        add_float (nodes, node->bounds.origin.x);
+        add_float (nodes, node->bounds.origin.y);
+        add_float (nodes, node->bounds.size.width);
+        add_float (nodes, node->bounds.size.height);
+        add_uint32 (nodes, texture_id);
+      }
+      return;
+
     case GSK_CONTAINER_NODE:
       {
         guint i;